<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateQiiSiteSeoTable extends Migration
{
    /**
     * Schema table name to migrate
     * @var string
     */
    public $set_schema_table = 'qii_site_seo';

    /**
     * Run the migrations.
     * @table qii_site_seo
     *
     * @return void
     */
    public function up()
    {
        if (Schema::hasTable($this->set_schema_table)) return;
        Schema::create($this->set_schema_table, function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->increments('id')->comment('ID');
            $table->string('name', 180)->default('')->comment('导航名称');
            $table->unsignedInteger('type')->default('0')->comment('导航类型');
            $table->unsignedInteger('top_id')->default('0')->comment('顶级导航ID');
            $table->unsignedInteger('parent_id')->default('0')->comment('上级导航ID');
            $table->string('icon', 180)->default('')->comment('图标');
            $table->unsignedInteger('sortrank')->default('0')->comment('排序');
            $table->unsignedTinyInteger('is_new_window')->default('0')->comment('新窗口打开');
            $table->unsignedInteger('modified')->default('0')->comment('添加/修改时间');

            $table->index(["parent_id"], 'site_parent');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
     public function down()
     {
       Schema::dropIfExists($this->set_schema_table);
     }
}
